package cn.joeg.app.css.util;

import cn.joeg.app.GCore;
import cn.joeg.app.css.util.dto.CallSession;
import com.ecfront.dew.core.cluster.ClusterDistMap;
import org.springframework.stereotype.Component;

/**
 * 客服支撑系统常用操作类
 */
@Component
public class CSS {

    @Component
    public static class Call {

        private static final String CACHE_KEY = "dew:css:call:session:";
        private static final ClusterDistMap<CallSession> MAP = GCore.cluster.dist.map(CACHE_KEY, CallSession.class);

        public static CallSession getCallSession() {
            return MAP.get(GCore.context().optInfo().get().getAccountCode());
        }

        public static void setCallSession(CallSession callSession) {
            MAP.put(GCore.context().optInfo().get().getAccountCode(), callSession);
        }

        public static void deleteCallSession() {
            MAP.remove(GCore.context().optInfo().get().getAccountCode());
        }
    }

    public static class CommonKeyData {

        // 客户-基础-姓名
        public static final String CUSTOMER_BASIC_NAME = "customer_basic_name";
        // 客户-基础-证件号
        public static final String CUSTOMER_BASIC_CREDENTIALS = "customer_basic_credentials";
        // 客户-基础-地址
        public static final String CUSTOMER_BASIC_ADDRESS = "customer_basic_address";
        // 客户-基础-手机号码
        public static final String CUSTOMER_BASIC_PHONE = "customer_basic_phone";

    }
}
